﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MINERP.CustomerManage.OrderInfo
{
    public partial class FrmFindByCtmName : Form
    {
        //属性
        private FrmCheckOrderInfo frm;
        public FrmCheckOrderInfo Frm
        {
            get;
            set;
        }
        //参数
        BLL.CustomerManage.CheckOrderInfoBLL bll = new MINERP.BLL.CustomerManage.CheckOrderInfoBLL();
        //string
        string CurrentOrderProductCode = "";
        public FrmFindByCtmName()
        {
            InitializeComponent();
        }

        private void FrmFindByCtmName_Load(object sender, EventArgs e)
        {

        }

        private void btnFind_Click(object sender, EventArgs e)
        {
            BindOrderInfo();
        }

        private void cbProductList_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            CurrentOrderProductCode = cbProductList.SelectedValue.ToString();
        }

        //------------公共方法--------------
        private void BindOrderInfo()
        {
            string ctmName = txtCtmName.Text.Trim();
            if (ctmName.Length == 0)
                return;
            DataTable dt = bll.FindOrderInfo(ctmName);
            cbProductList.DisplayMember = "OrderProductName";
            cbProductList.ValueMember = "OrderProductCode";
            cbProductList.DataSource = dt;
        }

        private void cbProductList_SelectedIndexChanged(object sender, EventArgs e)
        {
            CurrentOrderProductCode = cbProductList.SelectedValue.ToString();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            Frm.txtOrderProductCode.Text = CurrentOrderProductCode;
            Frm.btnOk_Click(sender, e);
            this.Close();
        }
    }
}
